<?
    $accounts = array();
    foreach ($this->accounts as $account)
        $accounts[] = array("id" => $account->getId(), "login" => $account->getLogin(), "display_name" => $account->getDisplayName(), "short_name" => $account->getShortName());

    echo json_encode($accounts);
?>